package cn.edu.hbpu.service.impl;

import cn.edu.hbpu.common.R;
import cn.edu.hbpu.entity.FirstCategory;
import cn.edu.hbpu.mapper.FirstCategoryMapper;
import cn.edu.hbpu.service.FirstCategoryService;
import cn.hutool.http.HttpStatus;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lcy
 * @date 2022/8/24 8:51
 * @description
 */
@Service
public class FirstCategoryServiceImpl implements FirstCategoryService {

    @Autowired
    private FirstCategoryMapper firstCategoryMapper;

    @Override
    public R<List<FirstCategory>> getFirstCategoryList() {
        LambdaQueryWrapper<FirstCategory> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(FirstCategory::getSort);
        List<FirstCategory> firstCategoryList = firstCategoryMapper.selectList(queryWrapper);
        return new R<>(HttpStatus.HTTP_OK, firstCategoryList);
    }
}
